/*
题目链接:https://leetcode.cn/problems/count-subarrays-of-length-three-with-a-condition/description/?envType=daily-question&envId=2025-04-27
*/

//题解代码:

class Solution {
public:
    int countSubarrays(vector<int>& nums) {
        int n = nums.size();
        int ans = 0;
        for(int i=2;i<n;++i){
            if(nums[i-1] == (nums[i-2] + nums[i])*2) ++ans;
        }
        return ans;
    }
};
